package com.framework.modules.dataview.service.impl;

import com.framework.modules.dataview.dao.ViewChatFriendListDao;
import com.framework.modules.dataview.entity.ViewChatFriendListEntity;
import com.framework.modules.dataview.service.ViewChatFriendListService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.common.utils.PageUtils;
import com.framework.common.utils.Query;




@Service("viewChatFriendListService")
public class ViewChatFriendListServiceImpl extends ServiceImpl<ViewChatFriendListDao, ViewChatFriendListEntity> implements ViewChatFriendListService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        EntityWrapper wrapper=new EntityWrapper<ViewChatFriendListEntity>();
        if(params.containsKey("object_uid")){
            wrapper.eq("object_uid",params.get("object_uid"));
        }
        if(params.containsKey("states")){
            wrapper.in("state", params.get("states").toString());
        }
        if(params.containsKey("state")){
            wrapper.eq("state", params.get("state"));
        }
        if(params.containsKey("is_liked")){
            wrapper.eq("is_liked",params.get("is_liked"));
        }
        Page<ViewChatFriendListEntity> page = this.selectPage(
                new Query<ViewChatFriendListEntity>(params).getPage(),
                wrapper.orderBy("adddate",false)
        );

        return new PageUtils(page);
    }

}
